<template>
  <el-form
    :model="receiptData"
    label-width="80px"
    size="small"
  >
    <el-form-item :label="$t('product_purchase_cmpts_receiptform_160')">
      <div>{{ receiptData.purchaseNo }}</div>
    </el-form-item>
    <el-form-item :label="$t('product_purchase_cmpts_receiptform_161')">
      <div>{{ receiptData.purchaserName }}</div>
    </el-form-item>
    <el-form-item :label="$t('product_purchase_cmpts_receiptform_162')">
      <div>{{ receiptData.quantity }}</div>
    </el-form-item>
    <el-form-item :label="$t('product_purchase_cmpts_receiptform_163')">
      <div>{{ getFormatTime(receiptData.createTime) }}</div>
    </el-form-item>
    <el-table
      ref="dataTable"
      :data="receiptData.purchaseItemList"
      tooltip-effect="dark"
      style="width: 100%"
      :cell-style="{textAlign: 'center'}"
      :header-cell-style="{textAlign: 'center'}"
      max-height="240px"
    >
      <el-table-column
        prop="productSn"
        :label="$t('product_purchase_cmpts_receiptform_164')"
        width="120"
      />
      <el-table-column
        prop="productName"
        :label="$t('product_purchase_cmpts_receiptform_165')"
        width="120"
        show-overflow-tooltip
      />
      <el-table-column :label="$t('product_purchase_cmpts_receiptform_166')">
        <template v-slot="scope">
          <el-image :src="scope.row.imageUrl" fit="contain" style="height: 80px;"/>
        </template>
      </el-table-column>
      <el-table-column prop="color" :label="$t('product_purchase_cmpts_receiptform_167')" />
      <el-table-column prop="size" :label="$t('product_purchase_cmpts_receiptform_168')" />
      <el-table-column prop="quantity" :label="$t('product_purchase_cmpts_receiptform_162')" />
    </el-table>
  </el-form>
</template>

<script>
import { getFormatTime } from '@/utils/timeFormatter'

export default {
  name: 'ReceiptForm',
  props: {
    receiptData: {
      type: Object,
      required: true
    }
  },
  methods: {
    getFormatTime,
  }
}
</script>

<style lang="scss" scoped>

</style>
